{extend name='index/index' /}

{block name='main'}
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div id="tpl-echarts"></div>
<div class="tpl-content-wrapper">

    <div class="container-fluid am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                <div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 表格 <small>Amaze UI</small></div>
                <p class="page-header-description">Amaze UI 有许多不同的表格可用。</p>
            </div>
            <div class="am-u-lg-3 tpl-index-settings-button">
                <!--<button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置</button>-->
            </div>
        </div>

    </div>

    <div class="row-content am-cf">

        <div class="row">

            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">查看{$name}的客户</div>
                        <div class="widget-function am-fr">
                            <a href="javascript:;" class="am-icon-cog"></a>
                        </div>
                    </div>
                    <div class="widget-body  widget-body-lg am-fr">

                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                            <tr>
                                <th>id</th>
                                <th>姓名</th>
                                <th>期货账户</th>
                                <th>手机号</th>
                                <th>会员等级</th>
                                <th>创建时间</th>
                                <th>认证状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name='list' id='user'}

                            <tr class="even gradeC">
                                <td>{$user.id}</td>
                                <td>{$user.name}</td>
                                <td>{$user.assetaccount}</td>
                                <td>{$user.phonenumber}</td>
                                <td>{if condition="$user.register == 1"} 企业会员
                                    {elseif condition="$user.register == 2"/}代理商
                                    {else /} 终端
                                    {/if}
                                </td>
                                <td>{$user.creationtime}</td>
                                <td>{if condition="$user.RNA == 1"} <strong style="color: green;font-weight: 900">✔</strong>
                                    {elseif condition="$user.RNA == 2"/} <strong style="color: yellow;font-weight: 900">▬</strong>
                                    {else /} <strong style="color: red;font-weight: 900">✘</strong>
                                    {/if}</td>
                                <td>
                                    <div class="tpl-table-black-operation">

                                        <!-- Button trigger modal -->
                                        <a href="javascript:;" onclick="show({$user.id})"  class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
                                            查看信息
                                        </a>



                                        <!--<a href="javascript:;">-->
                                            <!--<i class="am-icon-pencil"></i> 编辑-->
                                        <!--</a>-->
                                        <!--<a href="javascript:;" class="tpl-table-black-operation-del">-->
                                            <!--<i class="am-icon-trash"></i> 删除-->
                                        <!--</a>-->
                                    </div>
                                </td>
                            </tr>
                            {/volist}
                            <!-- more data -->
                            </tbody>
                        </table>

                        {$page}
                    </div>
                </div>
            </div>

            <!-- Modal -->
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" style="margin-top: 15%;" aria-labelledby="myModalLabel">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel">Modal title</h4>
                        </div>
                        <div class="modal-body">
                            <h5 id="dqqy"></h5>
                            <h5 id="kyzj"></h5>
                            <h5 id="bzj"></h5>
                            <h5 id="yxzj"></h5>
                            <h5 id="lhzj"></h5>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <!--<button type="button" class="btn btn-primary">Save changes</button>-->
                        </div>
                    </div>
                </div>





        </div>

    </div>
</div>
</div>
<script>
    function show($id) {
        console.log($id);
        $.ajax({
            type:'get',
            url:'/vip_agent/Vip/show?id='+$id,
            dataType:'json',
            success:function (data) {
                if(data.status==2){
                    $('#myModalLabel').html('用户 '+data.name+' 的信息：');
                    $('#dqqy').html('当前权益：'+'查询错误');
                    $('#kyzj').html('可用资金：'+'查询错误');
                    $('#bzj').html('保证金：'+'查询错误');
                    $('#yxzj').html('优先资金：'+'查询错误');
                    $('#lhzj').html('劣后资金：'+'查询错误');
                    alert(data.msg);
                }else{
                    $('#myModalLabel').html('用户 '+data.name+' 的信息：');
                    $('#dqqy').html('当前权益：'+data.res.Balance);
                    $('#kyzj').html('可用资金：'+data.res.Available);
                    $('#bzj').html('保证金：'+data.res.Margin);
                    $('#yxzj').html('优先资金：'+data.res.Credit);
                    var dqqy=data.res.Balance-data.res.Credit;
                    $('#lhzj').html('劣后资金：'+dqqy);
                }



            },
            error:function () {
                console.log(222);
            }
        })
    }

</script>
{/block}